using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_ReturnMap : EntityTypeConfiguration<SO_Return>
    {
        public SO_ReturnMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Return__, t.DATE, t.LOCAL_OVERHEAD });

            // Properties
            this.Property(t => t.Return__)
                .IsRequired()
                .HasMaxLength(7);

            this.Property(t => t.VENDOR)
                .HasMaxLength(50);

            this.Property(t => t.VENDOR__)
                .HasMaxLength(6);

            this.Property(t => t.CURRENCY)
                .HasMaxLength(5);

            this.Property(t => t.BATCH)
                .HasMaxLength(10);

            this.Property(t => t.SHIPMENT)
                .HasMaxLength(8);

            this.Property(t => t.Cash_VAT_Acct)
                .HasMaxLength(20);

            this.Property(t => t.SEASON)
                .HasMaxLength(20);

            this.Property(t => t.COST_CENTER)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("SO_Return");
            this.Property(t => t.Return__).HasColumnName("Return_#");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.VENDOR).HasColumnName("VENDOR");
            this.Property(t => t.VENDOR__).HasColumnName("VENDOR_#");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.Cost_After_Discount).HasColumnName("Cost_After_Discount");
            this.Property(t => t.LANDED_COST).HasColumnName("LANDED_COST");
            this.Property(t => t.BATCH).HasColumnName("BATCH");
            this.Property(t => t.SHIPMENT).HasColumnName("SHIPMENT");
            this.Property(t => t.LOCAL_OVERHEAD).HasColumnName("LOCAL_OVERHEAD");
            this.Property(t => t.TAX).HasColumnName("TAX");
            this.Property(t => t.Imported).HasColumnName("Imported");
            this.Property(t => t.Cash_VAT_Acct).HasColumnName("Cash_VAT_Acct");
            this.Property(t => t.SEASON).HasColumnName("SEASON");
            this.Property(t => t.BUSINESS_UNIT).HasColumnName("BUSINESS_UNIT");
            this.Property(t => t.COUNTRY).HasColumnName("COUNTRY");
            this.Property(t => t.COST_CENTER).HasColumnName("COST_CENTER");
            this.Property(t => t.NOTE).HasColumnName("NOTE");
        }
    }
}
